import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-02-15
 * Time: 17:45
 */



public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("张三",12);
        Student student2 = new Student("张三",4);
        System.out.println(student1.equals(student2));
        System.out.println(student1.compareTo(student2));

        NameComparator nameComparator = new NameComparator();
        int ret = nameComparator.compare(student1,student2);
        System.out.println(ret);

        AgeComparator ageComparator = new AgeComparator();
        System.out.println(ageComparator.compare(student1,student2));

       //Incmp incmp = new Incmp();
        //匿名内部类



        Queue<Integer> priorityQueue1 = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2.compareTo(o1);
            }
        });

        // Queue<Integer> priorityQueue1 = new PriorityQueue<>((o1,o2)->{return o2.compareTo(o1);}); lambda表达式的写法
        priorityQueue1.offer(1);
        priorityQueue1.offer(2);
        System.out.println();

    }

}
